<div class="widget">
	<div class="widget-header bg-blue">
		<i class="widget-icon icon-notebook"></i> 
		<span class="widget-caption"> 广告信息 </span>
		<div class="widget-buttons">
			<a href="javascript:void(0);" onclick="handlerCancel(this);" title="关闭"
				 data-toggle="dispose" data-refresh-table="#table-banner"> <i class="fa fa-times"></i> </a> 
		</div>
	</div>
	<div class="widget-body">
		<!-- TODO 广告图片 -->
		<div class="widget radius-bordered ">
			<div class="widget-header">
				<i class="widget-icon ion-images"></i> 
					<span class="widget-caption"> <a href="" data-toggle="collapse">广告图片 </a>
					</span>
				<div class="widget-buttons compact">
					<a href="" data-toggle="collapse"> <i class="fa fa-compress"></i></a>
				</div>
			</div>
			<div class="widget-body">
				<div class="row">
					<div class="col-sm-12">
						<input id="upload" name="file" type="file" class="file-loading"
							accept="image/*" multiple>
					</div>
				</div>
			</div>
		</div>
		
		<!-- TODO 基本信息 -->
		<div class="widget radius-bordered">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> 
				<span class="widget-caption"> 基本信息 </span>
			</div>
			<div class="widget-body editor-body-sm editor-body-banner">
				<!-- dynamic data -->
			</div>
		</div>
	</div>
</div>

<!-- 提交表单 ========================================================= -->
<form id="editor-form-banner" action="/miwawa/default/common/update" method="post" 
			name="com.app.miwawa.api.system.entity.Banner">
</form>

    
<script type="text/javascript">
<!--
	require(['domReady'], function(domReady){
		domReady(function () {
			loadData();
		});
	});
	 
	function loadData(){
		var banner = jQuery("#table-banner").data("selectedRow");
		
		jQuery(".editor-body-banner").loadform("load", {
			templateId: "#view-banner-template",
			templatePath: "/miwawa/content/system/banner/template.html",
			templateData: banner,
			
			onLoadSuccess: function(){
				
				require(['jquery.plugin.form'],function(form){
					form.tooltip("[data-toggle='tooltip']");
					form.datepicker('.date-selector');
					form.chosen("#status").select("#status",null,function(chosen){						
					});
					$("#status").val($("#sid").val());
					
					// 注册文件上传控件
					form.fileinput("#upload", { 
						uploadUrl:"/miwawa/default/file/upload",
						uploadExtraData: {
							"group": "banner",
							"mode": "file",
							"type": "image"
						},
						allowedFileExtensions: ["jpg", "png", "gif"],
						onUploadSuccess:function(event, data, previewId, index){
							event.preventDefault;
							loaderFile();
							$("#url").val(data.response.url);
							jQuery("#upload").fileinput('reset');
						}
					});
					
					// 加载文件
					loaderFile();
					
				});
				
			}
		
		});
	}
	
	
	// 文件删除
	function handlerDelete(){
		var photos = jQuery(".image-picker").data('picker').selected_values();
		if(photos.length <= 0){
			jQuery.message.warning("请选择要删除的图片！");
		}else{
			jQuery.ajaxsend({
				url:"/miwawa/default/file/delete",
				data:{ids:photos.join(",")},
				success:function(data){
					if(data && data.success) loaderFile();
				}
			});
		}
	}
	
	// 加载文件
	function loaderFile(){
		require(['jquery.plugin.form'],function(form){
			form.imagepicker(".image-picker",{
				url:"/miwawa/default/file/find.json",
			});
		});
	}

	
//-->
</script>